package com.hl.springcloud.pack.service.impl;

import com.hl.springcloud.pack.rpc.OrderClient;
import com.hl.springcloud.pack.service.IPackService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by aaron on 2017/1/19.
 */
@Service
public class PackService implements IPackService {
    @Autowired
    private OrderClient orderClient;

    @Override
    @HystrixCommand(fallbackMethod = "fallback")
    public String add(Integer a, Integer b) {
        //执行pack逻辑
        //invoke order rpc
        return orderClient.add(a,b);
    }

    public String fallback(Integer a, Integer b){
        return "some exception occur call fallback method.";
    }
}
